package com.acquisition.service.impl;

import com.acquisition.entity.DayData;
import com.acquisition.entity.HourData;
import com.acquisition.mapper.HourDataMapper;
import com.acquisition.service.HourDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @title：
 * @author：Yu
 * @create：2023-04-15 19:45
 * @description：
 */
@Service
public class HourDataServiceImpl implements HourDataService {
    @Autowired
    HourDataMapper hourDataMapper;

    @Override
    public int save(HourData hourData) {

        int save = hourDataMapper.save(hourData);
        Integer id = hourData.getId();
        return id;
    }

    @Override
    public int remove(int id) {
        int remove = hourDataMapper.remove(id);
        if (remove > 0) {
            return 1;
        } else {
            return -1;
        }
    }

    @Override
    public int update(HourData hourData) {
        int update = hourDataMapper.update(hourData);
        if (update > 0) {
            return 1;
        } else {
            return -1;
        }
    }

    @Override
    public HourDataMapper get(int id) {
        return hourDataMapper.get(id);
    }

    @Override
    public List<HourData> queryByExample(Map<String, Object> param) {
        List<HourData> hourDataMappers = hourDataMapper.queryByExample(param);
        if (hourDataMappers != null && hourDataMappers.size() > 0) {
            return hourDataMappers;
        } else {
            return null;
        }
    }

    @Override
    public int count(Map<String, Object> param) {
        return 0;
    }

    @Override
    public int removeAll() {
        return 0;
    }

    @Override
    public int updateFlag(int serverNum, int id) {
        return 0;
    }

    @Override
    public int updateQn(String qn, int id) {
        return 0;
    }
}
